package com.atguigu.guli.service.edu.controller.admin;

/**
 * ClassName: LoginController <br/>
 * Description: <br/>
 *
 * @author ZMR<br />
 * date: 2020/12/18 12:34<br/>
 * @since JDK 1.11
 */

import com.atguigu.guli.service.base.result.R;
import org.springframework.web.bind.annotation.*;

//package com.atguigu.guli.service.edu.controller;
@CrossOrigin //跨域
@RestController
@RequestMapping("/user")
public class LoginController {

    /**
     * 登录
     *
     * @return
     */
    @PostMapping("login")
    public R login() {

        return R.ok().data("token", "admin");
    }

    /**
     * 获取用户信息
     *
     * @return
     */
    @GetMapping("info")
    public R info() {

        return R.ok()
                .data("roles", "[admin]")
                .data("name", "admin")
                .data("avatar", "https://oss.aliyuncs.com/aliyun_id_photo_bucket/default_handsome.jpg");
    }

    /**
     * 退出
     *
     * @return
     */
    @PostMapping("logout")
    public R logout() {
        return R.ok();
    }
}